<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" media="screen" href="../../css/bootstrap.min.css">
</head>
<body>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
	<form class="form-horizontal" onsubmit="return false" id="form">
		<fieldset>
			<div class='form-group'>
				<label class='col-md-2 control-label'>商品编号</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='productNo' type='text' name='productNo' id='productNo' data-bv-notempty='true' data-bv-notempty-message='商品编号 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>规格编号</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='specificationsNo' type='text' name='specificationsNo' id='specificationsNo' data-bv-notempty='true' data-bv-notempty-message='规格编号 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>规格名称</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='specificationsName' type='text' name='specificationsName' id='specificationsName' data-bv-notempty='true' data-bv-notempty-message='规格名称 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>已上架库存</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='itemupshelfTotal' type='text' name='itemupshelfTotal' id='itemupshelfTotal' data-bv-notempty='true' data-bv-notempty-message='itemupshelfTotal 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>虚拟库存</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='virtualInventory' type='text' name='virtualInventory' id='virtualInventory' data-bv-notempty='true' data-bv-notempty-message='virtualInventory 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>成本价</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='costPrice' type='text' name='costPrice' id='costPrice' data-bv-notempty='true' data-bv-notempty-message='costPrice 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>营销价</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='internalPrice' type='text' name='internalPrice' id='internalPrice' data-bv-notempty='true' data-bv-notempty-message='internalPrice 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>内部价</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='marketingPrice' type='text' name='marketingPrice' id='marketingPrice' data-bv-notempty='true' data-bv-notempty-message='marketingPrice 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>会员价</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='actualPrice' type='text' name='actualPrice' id='actualPrice' data-bv-notempty='true' data-bv-notempty-message='actualPrice 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>商品状态</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='state' type='text' name='state' id='state' data-bv-notempty='true' data-bv-notempty-message='state 不能为空'>
				</div>
			</div>


			<div class="form-actions">
				<div class="row" align="center">
					<div class="col-md-12">
					    <button class="btn btn-primary" onclick="location.href='tswProductListTest.html'">返回</button>
						<button class="btn btn-primary" type="submit" onclick="add()">
							<i class="fa fa-save"></i> 保存
						</button>
					</div>
				</div>
			</div>

		</fieldset>
	</form>
</div>
	<script type="text/javascript" src="../../js/libs/jquery-2.1.1.min.js"></script>
	<script type="text/javascript" src="../../js/jq.js"></script>
	<script type="text/javascript" src="../../js/plugin/bootstrapvalidator/bootstrapValidator.min.js"></script>
	<script type="text/javascript" src="../../js/common.js"></script>
	<script type="text/javascript" src="../../layui/layui.js"></script>
	<script type="text/javascript">
		layui.use(['layer','laydate'], function(){
		    var layer = layui.layer;
		});
		
		function add() {
			$('#form').bootstrapValidator();
			var bootstrapValidator = $("#form").data('bootstrapValidator');
			bootstrapValidator.validate();
		    if(!bootstrapValidator.isValid()){
			   return;
		    }
		    
		    var formdata = $("#form").serializeObject();

			$.ajax({
				type : 'post',
				url : '/tswProducts',
				contentType: "application/json; charset=utf-8",  
				data : JSON.stringify(formdata),
				success : function(data) {
					layer.msg("添加成功", {shift: -1, time: 1000}, function(){
                        location.href = "tswProductList.html";
                    });
				}
			});
		}
		
	</script>
</body>
</html>
